Encapsulating Non-Determinism in Functional Logic Computations
نویسندگان
چکیده
One of the key features of the integration of functional and logic languages is the access to non-deterministic computations from the functional part of the program. In order to ensure the determinism of top-level computations in a functional logic program, which is usually a monadic sequence of I/O operations, one has to encapsulate the non-determinism (i.e., search for solutions) occurring in logic computations. However, an appropriate approach to encapsulation can be quite subtle if subexpressions are shared, as in lazy evaluation strategies. In this paper we examine the current approaches to encapsulate non-deterministic computations for the declarative multi-paradigm language Curry, show their relative advantages and the problems they induce. Furthermore, we present a new approach which combines the advantages but avoids the problems. Our proposal is based on providing a primitive I/O action for encapsulation from which various specialized search operators can be derived. In order to provide a formal foundation for this new approach to encapsulation, we define the operational semantics of this new primitive. 1 Why Encapsulate and How (Not) To Functional logic languages are intended to integrate the best features provided in functional and logic languages (see [7] for a survey). They also form a base to improve the evaluation strategies of existing languages due to the existence of optimal evaluation strategies for functional logic languages [3]. However, there is one subtle problem when combining the worlds of functional and logic programming. Usually, the top-level of a realistic functional (logic) program is a monadic sequence of I/O operations that should be applied to the outside world (e.g., see [23]). Since the outside world cannot be copied, all non-determinism in logic computations must be encapsulated, as proposed in [11] for the declarative ∗This work has been partially supported by the DFG under grants Ha 2457/1-2 and Ha 2457/5-1. †Institut für Informatik, Christian-Albrechts-Universität zu Kiel, D-24098 Kiel, Germany. {bbr,mh,fhu}@informatik.uni-kiel.de
منابع مشابه
Towards a Parallel Virtual Machine for Functional Logic Programming
Functional logic programming is a multi-paradigm programming that combines the best features of functional programming and logic programming. Functional programming provides mechanisms for demand-driven evaluation, higher order functions and polymorphic typing. Logic programming deals with non-determinism, partial information and constraints. Both programming paradigms fall under the umbrella o...
متن کاملEliminating Irrelevant Non-determinism in Functional Logic Programs
Functional logic programming languages support non-deterministic search and a flexible use of defined operations by applying them to unknown values. The use of these features has the risk that equal values might be computed several times or I/O computations could fail due to non-deterministic subcomputations. To detect such problems at compile time, we present a method to locate non-determinist...
متن کاملAn Implementation of Bubbling
Non-determinism is of great importance in functional logic programming. It provides expressiveness and efficiency to functional logic computations. In this paper we describe an implementation of the multiparadigm functional logic language Curry. The evaluation strategy employed by the implementation is based on definitional trees and needed narrowing for deterministic operations, while non-dete...
متن کاملOptimal Non-deterministic Functional Logic Computations
We show that non-determinism simplifies coding certain problems into programs. We define a non-confluent, but well-behaved class of rewrite systems for supporting non-deterministic computations in functional logic programming. We show the benefits of using this class on a few examples. We define a narrowing strategy for this class of systems and prove that our strategy is sound, complete, and o...
متن کاملProving Non-Deterministic Computations in Agda
We investigate proving properties of Curry programs using Agda. First, we address the functional correctness of Curry functions that, apart from some syntactic and semantic differences, are in the intersection of the two languages. Second, we use Agda to model non-deterministic functions with two distinct and competitive approaches incorporating the non-determinism. The first approach eliminate...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- Journal of Functional and Logic Programming
دوره 2004 شماره
صفحات -
تاریخ انتشار 2004